home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93b.txt / 000136_icon-group-sender _Wed Jun 16 08:28:28 1993.msg < prev    next >
Internet Message Format  |  1993-06-16  |  2KB

  1. Received: from owl.CS.Arizona.EDU by cheltenham.CS.Arizona.EDU; Wed, 16 Jun 1993 08:28:28 MST
  2. Received: by owl.cs.arizona.edu; Wed, 16 Jun 1993 08:28:27 MST
  3. Via: uk.ac.manchester.computer-science; Wed, 16 Jun 1993 02:10:46 +0100
  4. From: Steve Holden <steve@dtc.co.uk>
  5. Date: Tue, 15 Jun 93 23:11:44 BST
  6. Message-Id: <1040.9306152211@desktop.desktop.co.uk>
  7. To: icon-group@cs.arizona.edu, goer <@msuinfo,@uchinews:goer@ellis>
  8. Subject: Re: Pattern-Matching Help Request
  9. Status: R
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11.  
  12. Further to Richard Gorwitz's suggestion that
  13.  
  14.         if line ? (="%From ", tab(many(namechars)), ="@")
  15.         then...
  16.  
  17. be used to pattern-match senders' names, it is also, of course, possible
  18. to handle _particular_ recipients.  The simplest way is to define a list
  19. and use that, e.g.:
  20.  
  21.     senders := ["steve","the.happy.hacker",...,"icon-group"]
  22.  
  23.     ...
  24.  
  25.     if line ? (="%From",=!senders,="@")
  26.     then ...
  27.  
  28. If you wanted to identify the paricular sender you could change the second
  29. expression in the mutual evaluation to an assignment, as in
  30.  
  31.     if line ? (="%From ", s := =!senders,="@")
  32.  
  33. It would probably turn out to be efficient to use a set combined with the
  34. Goerwitz technique, as in
  35.  
  36.     senders := set(["steve","the.happy.hacker",...,"icon-group"])
  37.  
  38.     ...
  39.  
  40.     if line ? (="%From ",member(senders,s:=tab(many(namechars))),="@")
  41.     then ...
  42.  
  43. One of the valuable features of the Icon language is the ability to enlarge an
  44. expression without changing its result to enhance the actions your code takes.
  45.  
  46. regards
  47.  Steve
  48.  +---------------------------------+-------------------------------------+
  49.  | Steve Holden, Technical Director| Desktop Connection Limited          |
  50.  | steve@desktop.co.uk             | Manchester Science Park             |
  51.  |---------------------------------+ Lloyd Street North                  |
  52.  | Publish and be damned. Publish  | Manchester England M15 4EN          |
  53.  | electronically and be heard.    | Tel: +44 61 227 9055 Fax: 226 4922  |
  54.  +---------------------------------+-------------------------------------+
  55.